{% if aggregates %}
  <table class="tablesorter data-table">
    <thead>
      <tr>
        <th scope="col">Rank</th>
        <th scope="col">{{ aggregation | replace('_', ' ') | capitalize }}</th>
        <th scope="col">Count</th>
        <th scope="col">%</th>
      </tr>
    </thead>
    <tbody>
      {% for hit in aggregates %}
        <tr>
          <td>{{ loop.index }}</td>
          <td>{{ hit.term }}</td>
          <td>{{ hit.count }}</td>
          <td>{{ '%.2f' | format(100.0 * hit.count / total_count) }} %</td>
        </tr>
      {% endfor %}
    </tbody>
  </table>
{% else %}
  <p>No results were found.</p>
{% endif %}
